package com.wlc.socket;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @author 王立朝 wanglichao@champion-credit.com
 * @description socket测试
 * @date 2021-07-15 12:43
 */
public class TestSocket {

    public static void main(String[] args) {
        TestSocket testSocket = new TestSocket();
        testSocket.method01();
    }

    /**
     * 获取本地的IP地址
     */
    private void method01() {
        try {
            InetAddress localHost = InetAddress.getLocalHost();
            System.out.println("localHost.getAddress() = " + localHost.getHostAddress());
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
    }
}
